﻿define('providers',
    ['jquery', 'ko', 'basicObject', 'provider', 'providersSearch'],
function ($, ko, basicObject, provider, providersSearch) {
    var providers = function () {
        var self = this;
        
        var dateCellTemplate = '<span data-bind="css: \'kgCellText\', dateshower: $data.getProperty($parent)" />';
        var linkCellTemplate = '<div style="width: 100px"><a data-bind="css: \'kgCellText fill\'">Edit<a></div>';
        var columnsDefs = [
            { field: 'idnp', displayName: 'IDNP', width: '10%' },
            { field: 'lastName', displayName: 'Last name', width: '20%' },
            { field: 'firstName', displayName: 'First Name', width: '20%' },
            { field: 'department.title', displayName: 'Department', width: '20%' },
            { field: 'createdOn', cellTemplate: dateCellTemplate, displayName: 'Created On', width: '15%' },
            { field: 'id', cellTemplate: linkCellTemplate, displayName: 'Edit', width: '10%' }
        ];
        
        self.basicObject = ko.observable(new basicObject(columnsDefs, provider, providersSearch, "/api/Providers/GetByPage", "currentView", "Provider"));
        
    };

    return providers;

});